package com.scs.application.modules.msg.provider;


import com.scs.application.core.msg.domain.RawMessage;
import com.scs.application.modules.msg.entity.PushedRecord;
import com.scs.application.modules.msg.exception.SendMessageException;

/**
 * @Description:
 */
public interface SendMessageProvider<T extends RawMessage> {

    /**
     * 消息参数检查
     *
     * @param message
     * @return
     */
    default boolean check(T message) {
        return true;
    }

    /**
     * 发送消息
     *
     * @param message
     * @throws SendMessageException
     */
    void send(T message) throws SendMessageException;

    default boolean support(Class<? extends RawMessage> clz) {
        return false;
    }

    /**
     * 构建pushRecord
     *
     * @param pushedRecord
     * @param message
     * @return
     */
    PushedRecord getPushedRecord(PushedRecord pushedRecord, T message);


}
